home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d6 / glazer.arc / POINTS.BAS < prev    next >
BASIC Source File  |  1988-10-07  |  1KB  |  37 lines

  1. 100 'Points ("POINTS")
  2. 110 CLS
  3. 120 COLOR 0,15 : PRINT "Points" : COLOR 15,0
  4. 130 PRINT
  5. 140 DEFDBL A-Z
  6. 150 DEFINT M-N
  7. 160 '     Let user enter data
  8. 170 PRINT:PRINT "Do not enter dollar signs or commas"
  9. 180 PRINT
  10. 190 INPUT "Amount of loan: ", PNCPL
  11. 200 INPUT "Annual interest rate (in percent): ", AR
  12. 210 INPUT "Number of points: ", POINTS
  13. 220 INPUT "Annual interest rate on savings: ", RSAVINGS
  14. 230 INPUT "Length of loan (in years): ", NYEARS
  15. 240 '     Determine lost income from points
  16. 250 NMONTHS = 12 * NYEARS
  17. 260 PR = AR / 1200  'Convert to monthly interest rate
  18. 270 RSAVINGS = (1 + RSAVINGS / 100) ^ (1/12) - 1
  19. 280 IF POINTS > 0  THEN INCOMELOST = PNCPL * POINTS / 100 * RSAVINGS /                             ( 1 - (1 + RSAVINGS) ^ -NMONTHS)
  20. 290 '     Determine amortizing payment
  21. 300 IF PR <> 0  THEN PMT = PNCPL * PR / (1 - (1 + PR) ^ -NMONTHS)                               ELSE PMT = PNCPL / NMONTHS
  22. 310 PMT = PMT + INCOMELOST
  23. 320 '     Use bisection method to find effective interest rate
  24. 330 RLOWER = 0  'Initial values
  25. 340 RUPPER = .5
  26. 350 WHILE (RUPPER - RLOWER) > .00001
  27. 360   PR = (RLOWER + RUPPER) / 2
  28. 370   'Calculate payment for trial value
  29. 380   TRIALPMT = PNCPL / ( (1 - (1 + PR) ^ -NMONTHS) / PR)
  30. 390   IF TRIALPMT > PMT  THEN RUPPER = PR  ELSE RLOWER = PR
  31. 400 WEND
  32. 410 '     Print results
  33. 420 REFFECTIVE = (RUPPER + RLOWER) / 2 * 1200
  34. 430 PRINT
  35. 440 PRINT : PRINT "Effective interest rate:"; USING "###.##_%"; REFFECTIVE
  36. 450 END
  37.